package kayao.client.scene.objects;

import kayao.common.Client;

/**
 * Represents a moving entity in the networked virtual environment.
 * It has ghost translations and velocities which is the latest real
 * known translation and velocity before dead reckoning has been used
 * to predict a new translation.
 */
public class MovingEntity extends Entity {
	private float[] mGhostTranslation = new float[3];
	private float[] mGhostVelocity = new float[3];
	
	private float[] mVelocity = new float[3];
	
	/**
	 * Constructor which set the local host as the owner.
	 */
	public MovingEntity() {
		
	}
	
	/**
	 * Constructor which set the owner.
	 * @param owner the owner of the entity.
	 */
	public MovingEntity(Client owner) {
		super(owner);
	}
	
	/**
	 * Returns the ghost translation of all axes as an array.
	 * @return the ghost translation of all axes.
	 */
	public float[] getGhostTranslation() {
		return mGhostTranslation;
	}
	
	/**
	 * Sets the ghost translation of all axes with an array.
	 * @param ghostTranslation the ghost translation of all axes.
	 */
	public void setGhostTranslation(float[] ghostTranslation) {
		if (ghostTranslation.length == 3) {
			mGhostVelocity = ghostTranslation;
		}
	}
	
	/**
	 * Sets the ghost translation of all axes.
	 * @param ghostTranslationX the ghost translation of the x axis.
	 * @param ghostTranslationY the ghost translation of the y axis.
	 * @param ghostTranslationZ the ghost translation of the z axis.
	 */
	public void setGhostTranslation(float ghostTranslationX, float ghostTranslationY, float ghostTranslationZ) {
		mGhostTranslation[0] = ghostTranslationX;
		mGhostTranslation[1] = ghostTranslationY;
		mGhostTranslation[2] = ghostTranslationZ;
	}
	
	/**
	 * Returns the ghost translation of the x axis.
	 * @return the ghost translation of the x axis.
	 */
	public float getGhostTranslationX() {
		return mGhostTranslation[0];
	}
	
	/**
	 * Sets the ghost translation of the x axis.
	 * @param ghostTranslationX the ghost translation of the x axis.
	 */
	public void setGhostTranslationX(float ghostTranslationX) {
		mGhostTranslation[0] = ghostTranslationX;
	}
	
	
	/**
	 * Returns the ghost translation of the y axis.
	 * @return the ghost translation of the y axis.
	 */
	public float getGhostTranslationY() {
		return mGhostTranslation[1];
	}
	
	/**
	 * Sets the ghost translation of the y axis.
	 * @param ghostTranslationY the ghost translation of the y axis.
	 */
	public void setGhostTranslationY(float ghostTranslationY) {
		mGhostTranslation[1] = ghostTranslationY;
	}
	
	/**
	 * Returns the ghost translation of the z axis.
	 * @return the ghost translation of the z axis.
	 */
	public float getGhostTranslationZ() {
		return mGhostTranslation[2];
	}
	
	/**
	 * Sets the ghost translation of the z axis.
	 * @param ghostTranslationZ the ghost translation of the z axis.
	 */
	public void setGhostTranslationZ(float ghostTranslationZ) {
		mGhostTranslation[2] = ghostTranslationZ;
	}
	
	/**
	 * Returns the ghost velocity of all axes as an array.
	 * @return the ghost velocity of all axes.
	 */
	public float[] getGhostVelocity() {
		return mGhostVelocity;
	}
	
	/**
	 * Sets the ghost velocity of all axes with an array.
	 * @param ghostVelocity the ghost velocity of all axes.
	 */
	public void setGhostVelocity(float[] ghostVelocity) {
		if (ghostVelocity.length == 3) {
			mGhostVelocity = ghostVelocity;
		}
	}
	
	/**
	 * Sets the ghost velocity of all axes.
	 * @param ghostVelocityX the ghost velocity of the x axis.
	 * @param ghostVelocityY the ghost velocity of the y axis.
	 * @param ghostVelocityZ the ghost velocity of the z axis.
	 */
	public void setGhostVelocity(float ghostVelocityX, float ghostVelocityY, float ghostVelocityZ) {
		mGhostVelocity[0] = ghostVelocityX;
		mGhostVelocity[1] = ghostVelocityY;
		mGhostVelocity[2] = ghostVelocityZ;
	}
	
	/**
	 * Returns the ghost velocity of the x axis.
	 * @return the ghost velocity of the x axis.
	 */
	public float getGhostVelocityX() {
		return mGhostVelocity[0];
	}
	
	/**
	 * Sets the ghost velocity of the x axis.
	 * @param ghostVelocityX the ghost velocity of the x axis.
	 */
	public void setGhostVelocityX(float ghostVelocityX) {
		mGhostVelocity[0] = ghostVelocityX;
	}
	
	/**
	 * Returns the ghost velocity of the x axis.
	 * @return the ghost velocity of the x axis.
	 */
	public float getGhostVelocityY() {
		return mGhostVelocity[1];
	}
	
	/**
	 * Sets the ghost velocity of the y axis.
	 * @param ghostVelocityY the ghost velocity of the y axis.
	 */
	public void setGhostVelocityY(float ghostVelocityY) {
		mGhostVelocity[1] = ghostVelocityY;
	}
	
	/**
	 * Returns the ghost velocity of the x axis.
	 * @return the ghost velocity of the x axis.
	 */
	public float getGhostVelocityZ() {
		return mGhostVelocity[2];
	}
	
	/**
	 * Sets the ghost velocity of the z axis.
	 * @param ghostVelocityZ the ghost velocity of the z axis.
	 */
	public void setGhostVelocityZ(float ghostVelocityZ) {
		mGhostVelocity[2] = ghostVelocityZ;
	}
	
	/**
	 * Returns the velocity of all axes as an array.
	 * @return the velocity of all axes.
	 */
	public float[] getVelocity() {
		return mVelocity;
	}
	
	/**
	 * Sets the velocity of all axes with an array.
	 * @param Velocity the velocity of all axes.
	 */
	public void setVelocity(float[] Velocity) {
		if (Velocity.length == 3) {
			mVelocity = Velocity;
		}
	}
	
	/**
	 * Sets the velocity of all axes.
	 * @param VelocityX the velocity of the x axis.
	 * @param VelocityY the velocity of the y axis.
	 * @param VelocityZ the velocity of the z axis.
	 */
	public void setVelocity(float VelocityX, float VelocityY, float VelocityZ) {
		mVelocity[0] = VelocityX;
		mVelocity[1] = VelocityY;
		mVelocity[2] = VelocityZ;
	}
	
	/**
	 * Returns the velocity of the x axis.
	 * @return the velocity of the x axis.
	 */
	public float getVelocityX() {
		return mVelocity[0];
	}
	
	/**
	 * Sets the velocity of the x axis.
	 * @param VelocityX the velocity of the x axis.
	 */
	public void setVelocityX(float VelocityX) {
		mVelocity[0] = VelocityX;
	}
	
	/**
	 * Returns the velocity of the x axis.
	 * @return the velocity of the x axis.
	 */
	public float getVelocityY() {
		return mVelocity[1];
	}
	
	/**
	 * Sets the velocity of the y axis.
	 * @param VelocityY the velocity of the y axis.
	 */
	public void setVelocityY(float VelocityY) {
		mVelocity[1] = VelocityY;
	}
	
	/**
	 * Returns the velocity of the x axis.
	 * @return the velocity of the x axis.
	 */
	public float getVelocityZ() {
		return mVelocity[2];
	}
	
	/**
	 * Sets the velocity of the z axis.
	 * @param VelocityZ the velocity of the z axis.
	 */
	public void setVelocityZ(float VelocityZ) {
		mVelocity[2] = VelocityZ;
	}	
}
